// @ts-ignore
import { defineConfig } from 'vite'
import px2rem from 'postcss-px2rem'
// @ts-ignore
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from 'unplugin-vue-components/resolvers';
const px2remOptions = {
  rootValue({ file }) {
    return file.indexOf('vant') !== -1 ? 37.5 : 75;
  },
  propList: ['*'],
}
export default defineConfig({
  plugins: [vue(),Components({
    resolvers: [VantResolver()],
  }),],
  build:{
    outDir:'super-shop',
  },
  server: { //主要是加上这段代码
    host: '127.0.0.1',
    port: 3000,
    proxy: {
      '/pro-api': {
        target: 'http://zc-h5.guoguozuji.com/pro-api',	//实际请求地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/pro-api/, '')
      },
    }
  },
  resolve:{
    alias:{
      "src":"/src/",
      "@":"/src/"
    }
  },
  css:{
    postcss:{
      plugins:[px2rem({
        // 基准大小 baseSize，需要和rem.js中相同
        remUnit: 37.5
      })]
    }
  }
})
